// pages/user/shareShop.js
const app = getApp()
var util = require('../../utils/util.js')
var http = require('../../utils/server.js')
Page({
  data: {
    id: null,
    uid: null,
  },
  onLoad: function(options) {
    console.info(options);
    this.data.id = options.id;
    this.data.uid = options.uid;
  },
  //转发
  onShareAppMessage: function(ops) {
    var that = this;
    userInfo = wx.getStorageSync('userInfo')
    if (ops.from === 'button') {
      console.log(ops.target)
    }
    var path = 'pages/user/xiaodian?uid=' + that.data.uid + '&share=1';
    return {
      title: userInfo ? userInfo.name + '的羽毛球特卖店' : '羽毛球VIP-分享来自朋友的小店',
      path: path,
      imageUrl: userInfo ? userInfo.avatar : 'https://www.ymqvip.com/static/images/logo.png',
      success: function(res) {
        util.showSuccess('转发成功')
      }
    }

  },
  qrcode: function() {
    var that = this;
    http.post({
      url: "weixin/shopqrcode",
    }, function(data) {
      console.log(data)
      wx.previewImage({
        urls: [data]
      })
    })
  }
})